import * as Cesium from 'cesium';
import SpritelineTrainMaterialProperty from './material/SpritelineTrainMaterialProperty';

export default class RoadLightLine {
  constructor(viewer) {
    const getJsonPromise = Cesium.GeoJsonDataSource.load(
      './geojson/guangzhou-roadline.geojson'
    );

    getJsonPromise.then((dataSource) => {
      viewer.dataSources.add(dataSource);
      const entities = viewer.entities.values;

      const spritelineTrainMaterialProperty =
        new SpritelineTrainMaterialProperty();

      entities.forEach((entity) => {
        // console.log(entity);
        const polyline = entity.polyline;
        // console.log(polyline); // TODO 自定义线路的材质，更换失败
        // polyline.material = spritelineTrainMaterialProperty;
        // entity.polyline.material = spritelineTrainMaterialProperty;
      });
    });
  }
}
